home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / libnixV1_0.lha / gnu / libnix-sources.lha / examples / simpledev.c < prev    next >
C/C++ Source or Header  |  1995-01-22  |  7KB  |  153 lines

  1. /******************************************************************************/
  2. /*                                                                            */
  3. /* includes                                                                   */
  4. /*                                                                            */
  5. /******************************************************************************/
  6.  
  7. #include <exec/types.h>
  8. #include <exec/errors.h>
  9. #include <exec/execbase.h>
  10. #include <proto/exec.h>
  11. #include "stabs.h"
  12.  
  13. /******************************************************************************/
  14. /*                                                                            */
  15. /* exports                                                                    */
  16. /*                                                                            */
  17. /******************************************************************************/
  18.  
  19. const BYTE DevName[]="simple.device";
  20. const BYTE DevIdString[]="version 1.0";
  21.  
  22. const UWORD DevVersion=1;
  23. const UWORD DevRevision=0;
  24.  
  25. /******************************************************************************/
  26. /*                                                                            */
  27. /* global declarations                                                        */
  28. /*                                                                            */
  29. /******************************************************************************/
  30.  
  31. struct Device *myDevPtr;
  32. struct ExecBase *SysBase;
  33.  
  34. /******************************************************************************/
  35. /*                                                                            */
  36. /* user device initialization                                                 */
  37. /*                                                                            */
  38. /* !!! CAUTION: This function runs in a forbidden state !!!                   */
  39. /*                                                                            */
  40. /******************************************************************************/
  41.  
  42. int __UserDevInit(struct Device *myDev)
  43. {
  44.   /* required !!! */
  45.   SysBase=*(struct ExecBase **)4;
  46.  
  47.   /* setup your device base - to access device functions over *this* basePtr! */
  48.  
  49.   myDevPtr = myDev;
  50.  
  51.   /* now do your initialization */
  52.  
  53.      /* ... */
  54.  
  55.   /* return a bool to indicate success */
  56.  
  57.   return 0;
  58. }
  59.  
  60. /******************************************************************************/
  61. /*                                                                            */
  62. /* user device cleanup                                                        */
  63. /*                                                                            */
  64. /* !!! CAUTION: This function runs in a forbidden state !!!                   */
  65. /*                                                                            */
  66. /******************************************************************************/
  67.  
  68. void __UserDevCleanUp()
  69. {
  70.   /* your cleanup comes here */
  71.  
  72.      /* ... */
  73.  
  74.   /* nothing to return */
  75. }
  76.  
  77. /******************************************************************************/
  78. /*                                                                            */
  79. /* device dependent open function                                             */
  80. /*                                                                            */
  81. /* !!! CAUTION: This function runs in a forbidden state !!!                   */
  82. /*                                                                            */
  83. /******************************************************************************/
  84.  
  85. int __UserDevOpen(struct IORequest *iorq,ULONG unit,ULONG flags)
  86. {
  87.   int io_err=IOERR_OPENFAIL;
  88.  
  89.   /* return a bool to indicate success */
  90.  
  91.   return io_err;
  92. }
  93.  
  94. /******************************************************************************/
  95. /*                                                                            */
  96. /* device dependent close function                                            */
  97. /*                                                                            */
  98. /* !!! CAUTION: This function runs in a forbidden state !!!                   */
  99. /*                                                                            */
  100. /******************************************************************************/
  101.  
  102. void __UserDevClose(struct IORequest *iorq)
  103. {
  104.  
  105.   /* nothing to return */
  106. }
  107.  
  108. /******************************************************************************/
  109. /*                                                                            */
  110. /* device dependent beginio function                                          */
  111. /*                                                                            */
  112. /******************************************************************************/
  113.  
  114. ADDTABL_1(__BeginIO,a1);
  115.  
  116. void __BeginIO(struct IORequest *iorq)
  117. {
  118. };
  119.  
  120. /******************************************************************************/
  121. /*                                                                            */
  122. /* device dependent abortio function                                          */
  123. /*                                                                            */
  124. /******************************************************************************/
  125.  
  126. ADDTABL_1(__AbortIO,a1);
  127.  
  128. void __AbortIO(struct IORequest *iorq)
  129. {
  130. };
  131.  
  132. /******************************************************************************/
  133. /*                                                                            */
  134. /* additional device dependent functions                                      */
  135. /*                                                                            */
  136. /******************************************************************************/
  137.  
  138.  
  139.  
  140. /******************************************************************************/
  141. /*                                                                            */
  142. /* endtable marker (required!)                                                */
  143. /*                                                                            */
  144. /******************************************************************************/
  145.  
  146. ADDTABL_END();
  147.  
  148. /******************************************************************************/
  149. /*                                                                            */
  150. /* end of simpledev.c                                                         */
  151. /*                                                                            */
  152. /******************************************************************************/
  153.